﻿@model Easy.Web.CMS.Product.Models.ProductEntity
@{
    var images = Model.GetFields("image");
}
<div class="product-detail">
    <div class="page-header">
        <h1 class="align-center">
            @Model.Title
        </h1>
        <div class="align-right">
            <span>
                <i class="glyphicon glyphicon-user"></i>
                @Model.CreatebyName
            </span>
            <span>
                <i class="glyphicon glyphicon-calendar"></i>
                @((Model.PublishDate ?? DateTime.Now).ToString("yyyy/MM/dd"))
            </span>
            @if (Authorizer.Authorize(Easy.CMS.Product.PermissionKeys.ManageProduct))
            {
                <a href="@Url.Action("Edit", "Product", new { id = Model.ID,ReturnUrl=Request.Url.PathAndQuery })">编辑</a>
            }
        </div>
    </div>
    <div class="panel-body detail clearfix">
        @if (Model.Description.IsNotNullAndWhiteSpace())
        {
            <blockquote>
                <footer>
                    @Model.Description
                </footer>
            </blockquote>
        }
        @if (images.Any())
        {
            using (Script.AtFoot())
            {
                <script type="text/javascript" src="http://cdn.zkeasoft.com/Scripts/jcarousel/jquery.jcarousel.min.js"></script>
                <script type="text/javascript" src="http://cdn.zkeasoft.com/Scripts/jcarousel/jcarousel.basic.js"></script>
            }
            using (Style.AtFoot())
            {
                <link href="http://cdn.zkeasoft.com/Scripts/jcarousel/jcarousel.basic.css" rel="stylesheet" />
            }
            <div class="jcarousel-wrapper" style="width:402px;float:left;margin-right:30px;">
                <div class="jcarousel">
                    <ul>
                        @foreach (var item in images)
                {
                            <li>
                                <img src="@Url.PathContent(item.Value)"style="width:400px" />
                            </li>
                        }
                    </ul>
                </div>
                <a href="#" class="jcarousel-control-prev">&lsaquo;</a>
                <a href="#" class="jcarousel-control-next">&rsaquo;</a>
                <p class="jcarousel-pagination">
                </p>
            </div>
        }
        else if (Model.ImageUrl.IsNotNullAndWhiteSpace())
        {
            <img class="thumbnail" src="@Url.Content(Model.ImageUrl)" alt="@Model.Title" />
        }
        @Html.Raw(Model.ProductContent)
    </div>
</div>